home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / stdlib / RCS / Mem_DumpTrace.c,v < prev    next >
Encoding:
Text File  |  1991-12-03  |  2.5 KB  |  115 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  sprited:1.1.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     88.05.20.15.49.20;  author ouster;  state Exp;
  11. branches 1.1.1.1;
  12. next     ;
  13.  
  14. 1.1.1.1
  15. date     91.12.02.20.37.21;  author kupfer;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24.  
  25. 1.1
  26. log
  27. @Initial revision
  28. @
  29. text
  30. @/* 
  31.  * Mem_DumpTrace.c --
  32.  *
  33.  *    Source code for the "Mem_DumpTrace" library procedure.  See memInt.h
  34.  *    for overall information about how the allocator works.
  35.  *
  36.  * Copyright 1988 Regents of the University of California
  37.  * Permission to use, copy, modify, and distribute this
  38.  * software and its documentation for any purpose and without
  39.  * fee is hereby granted, provided that the above copyright
  40.  * notice appear in all copies.  The University of California
  41.  * makes no representations about the suitability of this
  42.  * software for any purpose.  It is provided "as is" without
  43.  * express or implied warranty.
  44.  */
  45.  
  46. #ifndef lint
  47. static char rcsid[] = "$Header: proto.c,v 1.2 88/03/11 08:39:08 ouster Exp $ SPRITE (Berkeley)";
  48. #endif not lint
  49.  
  50. #define MEM_TRACE 1
  51. #include "memInt.h"
  52.  
  53. /*
  54.  *----------------------------------------------------------------------
  55.  *
  56.  * Mem_DumpTrace --
  57.  *
  58.  *    Dump the allocation trace records for the given size block.  If
  59.  *    the size is specified as -1 then all trace records for all size
  60.  *    blocks are dumped.
  61.  *
  62.  * Results:
  63.  *    None.
  64.  *
  65.  * Side effects:
  66.  *    None.
  67.  *
  68.  *----------------------------------------------------------------------
  69.  */
  70.  
  71. void 
  72. Mem_DumpTrace(blockSize)
  73.     int    blockSize;
  74. {
  75.     register MemTraceElement    *trPtr;
  76.     int                i, j;
  77.  
  78.     for (i = 0, trPtr = memTraceArray; i < memNumSizesToTrace; i++, trPtr++) {
  79.     if ((trPtr->traceInfo.size != blockSize) && (blockSize != -1)) {
  80.         continue;
  81.     }
  82.     if (!(trPtr->traceInfo.flags & MEM_STORE_TRACE) ||
  83.         (trPtr->traceInfo.flags & MEM_TRACE_NOT_INIT)) {
  84.         continue;
  85.     }
  86.  
  87.     (*memPrintProc)(memPrintData, "Trace for size = %d:\n", 
  88.                       trPtr->traceInfo.size);
  89.     (*memPrintProc)(memPrintData, "Caller-PC      Num-blocks  \n");
  90.     for (j = 0; j < MAX_CALLERS_TO_TRACE; j++) {
  91.         if (trPtr->allocInfo[j].numBlocks == 0) {
  92.         break;
  93.         }
  94.         (*memPrintProc)(memPrintData, "%8x         %6d\n", 
  95.                       trPtr->allocInfo[j].callerPC,
  96.                       trPtr->allocInfo[j].numBlocks);
  97.     }
  98.     if  (blockSize != -1) {
  99.         break;
  100.     }
  101.     }
  102. }
  103. @
  104.  
  105.  
  106. 1.1.1.1
  107. log
  108. @Initial branch for Sprite server.
  109. @
  110. text
  111. @d18 1
  112. a18 1
  113. static char rcsid[] = "$Header: /sprite/src/lib/c/stdlib/RCS/Mem_DumpTrace.c,v 1.1 88/05/20 15:49:20 ouster Exp $ SPRITE (Berkeley)";
  114. @
  115.